package inseniarlingua.lang.en;

import static org.junit.Assert.*;
import groovy.transform.CompileStatic;
import groovy.transform.TypeCheckingMode;
import inseniarlingua.lang.VerbDef;
import inseniarlingua.lang.Article;
import inseniarlingua.lang.WordDef;
import inseniarlingua.lang.en.Analyzer;
import inseniarlingua.lang.en.NounEN;
import inseniarlingua.lang.en.NounENFactory;
import inseniarlingua.lang.en.VerbEngDef;
import inseniarlingua.lang.en.VerbsENFactory;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

@CompileStatic
class AnalyzerTest {
	Analyzer cut
	Map<String, WordDef> wordMap
	static VerbsENFactory verbENFactory = new VerbsENFactory()
	static NounENFactory nounENFactory = new NounENFactory()

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	@CompileStatic(TypeCheckingMode.SKIP)
	public void setUp() throws Exception {
		final List<WordDef> wordList = [
			new Article('the'),
			new Article('a'),
			new Article('an'),
			nounENFactory.getNoun("man"),
			verbENFactory.getVerb("talk")
		]
		wordMap = [:]
		for (WordDef word in wordList) {
			wordMap.put(word.getValue(), word)
			if (word instanceof VerbDef) {
				//transMap.put(en.present3rdPersonSingular, ia.present)
				wordMap.put(((VerbEngDef)word).present3rdPersonSingular, word)
			}
		}
		cut = new Analyzer()
		cut.setWordMap(wordMap)
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void test() {
		final sentence = "The man talks"
		final act = cut.analyze(sentence)
		println "act = $act"
	}
}
